<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class ParticipantesAdmin extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{	
		$this->load->model('eventoM');
		//$data2['participantes']= $this->participantes_model>listarAll();
		if($this->session->userdata('logueado')){
			$data = array();
			$data['nombre'] = $this->session->userdata('nombre');
			$this->load->view('headerAdmin', $data);
		}else{
			redirect('usuarios/iniciar_sesion');
		}
		$this->load->view('participantesAdmin');
		$this->load->view('footerAdmin');
		
	}

	public function listaPorEvento(){
		$this->load->model('eventoM');
        $id = $_GET["num"];
        echo $id;exit();
	}

	public	function agregar(){
		$this->load->library('form_validation');
		$this->load->model('participantes_model');
		$part = array(
					'nombre' => $this->input->post('nombre'),
					'apellido' => $this->input->post('apellido'),
					'direccion' => $this->input->post('direccion'),
					'telefono' => $this->input->post('telefono'),
					'mail' => $this->input->post('mail'),
				);

		/*print_r($evento);exit();*/
		$id_generado = $this->participantes_model->alta($part);
		
		//redirect('eventosAdmin');
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */